
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
	<head>
		<title>登录-国风汉服</title>
		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
		<link rel="stylesheet" type="text/css" href="../css/login_reg.css" />
		<script type="text/javascript" src="../js/jquery-3.3.1.min.js"></script>
	</head>

	<body id="reset_whole">
		<div id="wrap">
			<div id="top_content">

				<div id="content">
					<div id="h2"><h2>登录</h2></div>
					<form id="form-login" >
						<table cellpadding="0" cellspacing="0" border="0"
							class="form_table">
							
							<p>
								<span class="left_font" >
									用&nbsp;户&nbsp;名&nbsp;: 
								</span>
								<span class="right_input">
									<input type="text" class="inputgri" 
									name="username" />
								</span>
							</p>
							<p>
								<span class="left_font" >
									密&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;码:
								</span>
								<span class="right_input">
									<input type="password" 
									class="inputgri" name="password" />
								</span>
							</p>
						</table>
						<div id="btnn">
							<input type="button"  id="btn-login" class="button" value="登录" />&nbsp;&nbsp;&nbsp;&nbsp;
							<a href="reg.html"><input type="button"  class="button" value="注册" /></a><br>
							<a href="../index.html" style="font-size: xx-small">回到首页</a>
						</div>
					</form>
				</div>
			</div>
		</div>

		<script type="text/javascript">
            $("#btn-login").click(function () {
                //
                var url = "../user/login.do";
                var data =$("#form-login").serialize();

                console.log("登录参数："+data);
                //发出ajax请求并处理结果。
                $.ajax({
                    "url": url,
                    "data": data,
                    "type": "POST",
                    "dataType": "json",
                    "success": function (json) {
                        if (json.state == 200) {
                            window.location.href = "../index.html";

                        } else {
                            alert(json.message);
                        }
                    }
                });
            });
		</script>

	</body>
</html>
